package com.woniu.project.config;


import org.springframework.stereotype.Component;
import springfox.documentation.swagger.web.SwaggerResource;
import springfox.documentation.swagger.web.SwaggerResourcesProvider;

import java.util.Arrays;
import java.util.List;

/**
 * 网关配置的Swagger2
 * @Author: Klaus
 * @Date: 2020/9/29 10:51
 */
@Component
public class SwaggerConfig implements SwaggerResourcesProvider {
    @Override
    public List<SwaggerResource> get() {
        return Arrays.asList(
                getSr( "management-service","1.0-SNAPSHOT","/pawn/management/v2/api-docs"),
                getSr( "store-service","1.0-SNAPSHOT", "/pawn/store/v2/api-docs"),
                getSr( "shop-server","1.0-SNAPSHOT", "/pawn/shop/v2/api-docs"),
                getSr( "assess-server","1.0-SNAPSHOT", "/pawn/assess/v2/api-docs"),
                getSr( "product-server","1.0-SNAPSHOT", "/pawn/product/v2/api-docs")
        );
    }

    private SwaggerResource getSr(String name,String version,String url){
        SwaggerResource sr = new SwaggerResource();
        sr.setName(name);
        sr.setSwaggerVersion(version);
        sr.setUrl(url);
        return sr;
    }


}
